﻿using System;
using System.Collections.Generic;
using System.Linq;
using IQIGame.Onigao.GamePlay;

namespace IQIGame.Onigao.Logic
{
    public class BuffEffective_Burnout : BuffEffective
    {
        protected override void OnActive(BuffEffectContext rContext, BuffEffectData rConfig, int nRuntimeParam)
        {
            base.OnActive(rContext, rConfig, nRuntimeParam);
            var rBuffComp = rContext.buff.target;
            BuffHandler rBurn = null; // 写死一层
            for (int j = 0; j < rBuffComp.buffList.Count; j++)
            {
                var rBuff = rBuffComp.buffList[j];
                // 101 暂定为燃烧标签
                if (rBuff.config.Tag.Contains(101))
                {
                    rBurn = rBuff;
                    break;
                }
            }

            if (rBurn != null)
            {
                rBurn.OnDot(EBuffDotTriggerType.All);
                BuffController.Remove(rBurn.target, rBurn);
            }
        }

#if UNITY_EDITOR
        public override string ToString(BuffEffectData rConfig)
        {
            return $"燃烬";
        }
#endif
    }
}